package com.zzyl.mapper;


import com.github.pagehelper.Page;
import com.zzyl.dto.NursingPlanPageQueryDto;
import com.zzyl.entity.NursingPlan;
import com.zzyl.vo.NursingPlanVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface NursingPlanMapper {


    /**
     * 根据名称和状态分页查询
     *
     * @param dto 护理计划分页条件查询Dto
     * @return {@code Page<NursingPlanVo> }
     * @author YiSheep
     */
    Page<NursingPlanVo> pageQuery(NursingPlanPageQueryDto dto);

    /**
     * 添加护理计划
     *
     * @param nursingPlan 护理计划
     * @author YiSheep
     */
    void addNursingPlan(NursingPlan nursingPlan);

    /**
     * 根据ID查询护理计划
     *
     * @param id 护理计划ID
     * @return {@code NursingPlan }
     * @author YiSheep
     */
    @Select("select * from nursing_plan where id = #{id}")
    NursingPlan getById(Long id);

    /**
     * 修改护理计划
     *
     * @param nursingPlan 护理计划
     * @author YiSheep
     */
    void updateById(NursingPlan nursingPlan);

    /**
     * 删除护理计划
     *
     * @param id 护理计划ID
     * @author YiSheep
     */
    @Delete("delete from nursing_plan where id = #{id}")
    void deleteById(Long id);

    /**
     * 查询所有护理计划
     *
     * @return {@code List<NursingPlan> }
     * @author YiSheep
     */
    @Select("select * from nursing_plan where status = 1 order by sort_no,create_time desc")
    List<NursingPlan> getAllNursingPlan();
}
